package com.klw.business.domain;

import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.klw.common.annotation.Excel;
import com.klw.common.core.domain.BaseEntity;

/**
 * 机器学习特征对象 klw_ml_features
 *
 * @author klw
 * @date 2025-09-13
 */
public class KlwMlFeatures extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 特征ID */
    private Long featureId;

    /** 学生ID */
    @Excel(name = "学生ID")
    private Long studentId;

    /** 学期 */
    @Excel(name = "学期")
    private Long semesterId;

    /** 平均成绩 */
    @Excel(name = "平均成绩")
    private BigDecimal avgScore;

    /** 挂科门数 */
    @Excel(name = "挂科门数")
    private Long failCount;

    /** 考勤分数 */
    @Excel(name = "考勤分数")
    private Long absentScore;

    /** 行为分数 */
    @Excel(name = "行为分数")
    private Long behaviorScore;

    /** 学分总和 */
    @Excel(name = "学分总和")
    private BigDecimal creditScore;

    public void setFeatureId(Long featureId)
    {
        this.featureId = featureId;
    }

    public Long getFeatureId()
    {
        return featureId;
    }

    public void setStudentId(Long studentId)
    {
        this.studentId = studentId;
    }

    public Long getStudentId()
    {
        return studentId;
    }

    public void setSemesterId(Long semesterId)
    {
        this.semesterId = semesterId;
    }

    public Long getSemesterId()
    {
        return semesterId;
    }

    public void setAvgScore(BigDecimal avgScore)
    {
        this.avgScore = avgScore;
    }

    public BigDecimal getAvgScore()
    {
        return avgScore;
    }

    public void setFailCount(Long failCount)
    {
        this.failCount = failCount;
    }

    public Long getFailCount()
    {
        return failCount;
    }

    public void setAbsentScore(Long absentScore)
    {
        this.absentScore = absentScore;
    }

    public Long getAbsentScore()
    {
        return absentScore;
    }

    public void setBehaviorScore(Long behaviorScore)
    {
        this.behaviorScore = behaviorScore;
    }

    public Long getBehaviorScore()
    {
        return behaviorScore;
    }

    public void setCreditScore(BigDecimal creditScore)
    {
        this.creditScore = creditScore;
    }

    public BigDecimal getCreditScore()
    {
        return creditScore;
    }

    /**
     * 将特征转换为模型输入的double数组
     */
    public double[] toFeatureArray() {
        return new double[]{
                avgScore != null ? avgScore.doubleValue() : 0.0,
                failCount != null ? failCount : 0,
                absentScore != null ? absentScore : 0,
                behaviorScore != null ? behaviorScore : 0,
                creditScore != null ? creditScore.doubleValue() : 0.0
        };
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("featureId", getFeatureId())
                .append("studentId", getStudentId())
                .append("semesterId", getSemesterId())
                .append("avgScore", getAvgScore())
                .append("failCount", getFailCount())
                .append("absentScore", getAbsentScore())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .append("behaviorScore", getBehaviorScore())
                .append("creditScore", getCreditScore())
                .toString();
    }
}
